#ifndef DEVACCUATOR_H
#define DEVACCUATOR_H

#include "KzDevice.h"
using curveRaw = std::list<uint32_t>;
using curveVal = std::list<double>;
constexpr size_t curvePtsMax = 256;

class DevAccuator : public KzDevice
{

    /* 测量工具特有方法 */
public:
    double GetVoltageVal() const { return m_slvReport[ADC_CHANNEL_VOLT].result * ADC_VAL_SCALE; }
    uint32_t GetVoltageRaw() const { return m_slvReport[ADC_CHANNEL_VOLT].rawVal; }
    double GetCurrentVal() const { return m_slvReport[ADC_CHANNEL_CURR].result * ADC_VAL_SCALE; }
    uint32_t GetCurrentRaw() const { return m_slvReport[ADC_CHANNEL_CURR].rawVal; }
    const curveVal& GetVoltageValCurve() const { return m_curveVal[ADC_CHANNEL_VOLT]; }
    const curveRaw& GetVoltageRawCurve() const { return m_curveRaw[ADC_CHANNEL_VOLT]; }
    const FrmDumpMeasure& GetDevDump() const { return m_dump; }

public slots:
    void SlotSetCurrData(uint32_t ch, double val);

private:
    void ConfigCmdHandle() override;
    FrmAdcReport m_slvReport[2];
    FrmDumpMeasure m_dump;
    // 响应设备数据回报帧
    int MstEchoDump(const uint8_t* data, size_t len) override;
    int RecvAdcReport(const uint8_t* data, size_t len);
    int MstSetCalib(const uint8_t* data, size_t len);
    std::mutex m_dataLock;
    curveRaw m_curveRaw[2];
    curveVal m_curveVal[2];
};
#endif // DEVACCUATOR_H
